/**
 * 
 */
package com.google.code.netz.wfe.events;

import com.google.code.netz.wfe.model.WorkItem;

/**
 * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
 * @since 1.0
 * @version $Id$
 */
public class WorkItemEvent<T extends WorkItem<?>> extends TypedEvent<T> {

	public enum WorkItemEventType implements IEventType {

		/**
		 * Implies that a WorkItem has been activated for an open Case.
		 */
		WORKITEM_ACTIVATED("Work Item Activated"),

		/**
		 * Implies that a WorkItem has been opened (by an actor/event - which
		 * could be initiated by a User triggered action, or time trigged
		 * event).
		 */
		WORKITEM_OPENED("Work Item Opened"),

		/**
		 * Implies that the Workitem has been completed and is now inactive for
		 * an open Case.
		 */
		WORKITEM_CLOSED("Work Item Closed"),

		/**
		 * Implies that a running Workitem has been suspened.
		 */
		WORKITEM_SUSPENDED("Work Item Suspended");

		/**
		 * Event expressed as String.
		 */
		private String type;

		/**
		 * @param type
		 */
		private WorkItemEventType(String type) {
			this.type = type;
		}

		/**
		 * {@inheritDoc}
		 * 
		 * @see com.google.code.netz.wfe.events.IEventType#asString()
		 */
		@Override
		public String asString() {
			return type;
		}

		/**
		 * {@inheritDoc}
		 * 
		 * @see com.google.code.netz.wfe.events.IEventType#allEventTypes()
		 */
		@Override
		public IEventType[] allEventTypes() {
			return values();
		}

	}

	/**
	 * @param source
	 * @param type
	 */
	public WorkItemEvent(T source, IEventType type) {
		super(source, type);
	}

}
